import 'package:get/get.dart';
import 'package:sinosheets/network/api.dart';
import 'package:sinosheets/utils/lottie_utils.dart';

class NormalCategoryPListLogic extends GetxController {
  String categoryId = '';
  String categoryName = '';
  List productList = [];
  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
    LottieUtils.showToastLoading();
    categoryId = Get.arguments['categoryId'];
    categoryName = Get.arguments['categoryName'];
    getNomalProductPageList();
    update();
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
  }

  ///获取普货商品列表
  Future<void> getNomalProductPageList() async {
    BaseResponse response = await ProductApi.getNomalProductPageList({
      'pageNum': 1,
      'pageSize': 40,
      'firstCategoryId': categoryId,
    });
    if (response.isSuccess) {
      List list = response.list ?? [];
      productList = list;
      update();
    }
    LottieUtils.hideToastLoading();
  }
}
